﻿using System;
using DevExpress.XtraTab;

namespace Mota.XMLControls
{
    /// <summary>
    /// Represent TabControl based on DX XtraTabControl
    /// </summary>
    public class DXGuiTabControl:GuiTabControl
    {
        /// <summary>
        /// Create XtraTabControl
        /// </summary>
        public DXGuiTabControl()
        {
            visualControl = new XtraTabControl();
        }
        /// <summary>
        /// Add only XtraTabPage to XtraTabControl.TabPages
        /// </summary>
        /// <param name="guiControl"></param>
 
        public override void Add(GuiControl guiControl)
        {
            if(guiControl is DXGuiTab)
            {
                base.Add(guiControl);
                (visualControl as XtraTabControl).TabPages.Add((guiControl.visualControl as XtraTabPage));
            }
        }

        /// <summary>
        /// Set|Get XtraTabControl.Text propertie
        /// </summary>
        public override string Text
        {
            get
            {
                return (visualControl as XtraTabControl).Text;
            }
            set
            {
                (visualControl as XtraTabControl).Text = value;
            }
        }

        /// <summary>
        /// Dummy element
        /// </summary>
        public override object Binding
        {
            get
            {
                return null;
            }
            set
            {
              
            }
        }

        public override void SetValue(object valueBinding)
        {
            throw new NotImplementedException();
        }

        public override object GetValue()
        {
            throw new NotImplementedException("Tab dont have value");
        }
    }
}
